@extends('layout.admin')

@section('title')
    <title>品牌管理</title>
@endsection

@section('css')
    <link rel="stylesheet" href="{{asset('admin/css/goodsType.css')}}">
@endsection

@section('content')
    <div class=" admin-content">
        <div class="daohang">
            
        </div>
        <!-- -----------------------------                      添加品牌框                      ------------------------------ -->
        <div class="am-popup am-popup-inner" id="my-popup" style="height:460px; background: #f8f8f8;">
            <div class="am-popup-hd">
            <h4 class="am-popup-title">添加品牌</h4>
            <span data-am-modal-close class="am-close">&times;</span>
            </div>

            <div class="am-popup-bd">
                <form class="am-form tjlanmu addform" method="post" action="http://www.clothingmall.com/admin/brand" enctype="multipart/form-data">
                    {{csrf_field()}}
                    <div class="am-form-group">
                        <div class="zuo">分类名称：</div>
                        <div class="you">
                            <input type="text" class="am-input-sm" style="width:60%; display: inline-block;" name="name" id="doc-ipt-email-1" autofocus="true" placeholder="长度不能超过50个字符">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <div class="you" id="showSelectImg"></div>
                        <div class="you"></div>
                    </div>
                    <div class="am-form-group">
                        <div class="zuo">品牌logo：</div>
                        <div class="you">
                            <input type="file" class="am-input-sm" name="brandpic" id="doc-ipt-email-1">
                            <span class="am-text-danger">*请选择要上传的图片，格式为jpeg、png、bmp、gif、svg</span>
                        </div>
                    </div>
                    <div class="you">
                        
                    </div>
                    <div class="am-form-group">
                        <div class="zuo">品牌描述：</div>
                        <div class="you">
                            <textarea name="content" id="content" cols="30" style="resize:none;" rows="5"></textarea>
                        </div>
                    </div>
                   
                    <div class="am-form-group am-cf">
                        <div class="you">
                            <p>
                                <button type="submit" class="am-btn am-btn-success am-radius">添加</button>
                            </p>
                        </div>
                    </div>
                </form>
            </div>
        </div>  

        <!-- -----------------------------                      修改品牌信息                      ------------------------------ -->
        <div class="am-popup am-popup-inner" id="my-popupss" style="height:460px; background: #f8f8f8;">
            <div class="am-popup-hd">
                <h4 class="am-popup-title">修改品牌信息</h4>
                <span data-am-modal-close class="am-close">&times;</span> </div>
            <div class="am-popup-bd">
                    <form class="am-form tjlanmu updateForm" method="post" action="http://www.clothingmall.com/admin/brand" enctype="multipart/form-data">
                    {{csrf_field()}}
                    {{method_field('put')}}
                    <div class="am-form-group">
                        <div class="zuo">分类名称：</div>
                        <div class="you">
                            <input type="hidden" name="oldName" class="oldName" />
                            <input type="text" class="am-input-sm" style="width:60%; display: inline-block;" name="updatename" id="doc-ipt-email-1" autofocus="true" placeholder="长度不能超过50个字符">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <div class="you" id="updateImg"><img src="" width="70"></div>
                        <div class="you"></div>
                    </div>
                    <div class="am-form-group">
                        <div class="zuo">品牌logo：</div>
                        <div class="you">
                            <input type="file" class="am-input-sm updatebrandpic" name="updatebrandpic" id="doc-ipt-email-1">
                        </div>
                    </div>
                    <div class="you">
                        
                    </div>
                    <div class="am-form-group">
                        <div class="zuo">品牌描述：</div>
                        <div class="you">
                            <textarea name="content" class="content" id="content" cols="30" style="resize:none;" rows="5"></textarea>
                        </div>
                    </div>
                   
                    <div class="am-form-group am-cf">
                        <div class="you">
                            <p>
                                <button type="submit" class="am-btn am-btn-success am-radius">修改</button>
                            </p>
                        </div>
                    </div>
                </form>
            </div>
        </div>
       
        
        <div class="admin-biaogelist">
            <div class="listbiaoti am-cf">
                <ul class="am-icon-flag on">
                    品牌管理
                </ul>
                <dl class="am-icon-home" style="float: right;">
                    当前位置： 首页 > <a href="#">品牌管理</a>
                </dl>
                <dl>
                    <button type="button" class="am-btn am-modal-no-btn am-btn-danger am-round am-btn-xs am-icon-plus add" data-am-modal="{target: '#my-popup', width: 400, height: 225}">添加品牌</button>
                </dl>
                <!--data-am-modal="{target: '#my-popup'}" 弹出层 ID  弹出层 190行 开始  271行结束--> 
                
            </div>
            <div class="am-form am-g">
                <div class="search" style="height:50px; line-height: 30px; text-align: right;">
                    <form action="{{url('admin/brand')}}" method="get">
                        <input type="text" name="name" id="name" placeholder="要搜索的品牌关键字" style="width: 250px; height: 30px; display: inline-block;">
                        <button class="am-btn am-btn-primary" style="vertical-align: middle; height: 30px;">搜索</button>
                    </form>
                </div>
                <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover data">
                        <tr class="am-success">
                            <th class="table-id am-text-center"><input type="checkbox" class="selects" value="selects" /></th>
                            <th class="table-id am-text-center">ID</th>
                            <th class="table-title am-text-center">品牌名称</th>
                            <th class="table-title am-text-center">品牌logo</th>
                            <th class="table-title am-text-center">品牌描述</th>
                            <th class="table-title am-text-center">添加时间</th>
                            <th width="163px" class="table-set am-text-center">操作</th>
                        </tr>
                        </tr>


                    @foreach($res as $v)
                        <tr class="cont">
                            <td class="am-text-center" style="line-height:83px;"><input type="checkbox" class="sel" name="select[]" value="{{$v->id}}"></td>
                            <td class="am-text-center sequence" style="line-height:83px;">{{$v->id}}</td>
                            <td class="Tname am-text-center" style="line-height:83px;"><span>{{$v->name}}</span></td>
                            <td class="am-text-center logo" style="line-height:83px;"><img src="{{asset($v->brandpic)}}" height="70" /></td>
                            <td class="am-text-left am-text-center des" style="line-height:83px;">{{$v->desbrand}}</td>
                            <td class="am-text-left am-text-center" style="line-height:83px;">{{$v->createtime}}</td>
                            <td style="line-height:83px;"><div class="am-btn-toolbar opertion" style="text-align: center;">
                                    <a class="am-btn am-btn-default am-btn-xs am-text-secondary update" data-am-modal="{target: '#my-popupss'}" title="修改">
                                        <span class="am-icon-pencil-square-o" ></span>
                                    </a>

                                    <form action="{{url('admin/brand/'.$v->id)}}" class="submitData" method="post" style="display: inline;">
                                        {{csrf_field()}}
                                        {{method_field('DELETE')}}
                                        <button class="am-btn am-btn-default am-btn-xs am-text-danger del" title="删除">
                                            <span class="am-icon-trash-o"></span>
                                        </button>
                                    </form>
                                </div>
                            </td>
                        </tr>
                    @endforeach   
                </table>
                <form action="" method="post" style="float: left;" class="submitData batchDel">
                    {{csrf_field()}}
                    {{method_field('DELETE')}}
                    <button class="am-btn am-btn-danger" type="submit" style="margin-bottom: 10px;">批量删除</button>
                </form>
                {{ $res->appends(['name' => $likeWhere])->links() }}
                
            </div>
            <div class="foods">
                <ul>
                    版权所有@2015
                </ul>
                <dl>
                    <a href="" title="返回头部" class="am-icon-btn am-icon-arrow-up"></a>
                </dl>
            </div>
        </div>
    </div>
@endsection

@section('prompt')
    @if (count('errors'))
        @foreach ($errors->all() as $error)
            <div class='prompt fail'>
                    <p>{{ $error }}</p>
            </div>
        @endforeach
    @endif
@endsection

@section('js')
    <script type="text/javascript" src="{{asset('admin/js/brandCheck.js')}}">
    </script>
@endsection
